-
Notifications
You must be signed in to change notification settings - Fork 26.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use no-param-reassign's ignorePropertyModificationsFor option #1325
Use no-param-reassign's ignorePropertyModificationsFor option #1325
Conversation
fe37a66
to
999ec40
Compare
// rule: http://eslint.org/docs/rules/no-param-reassign.html | ||
'no-param-reassign': ['error', { props: true }], | ||
'no-param-reassign': ['error', { props: true, ignorePropertyModificationsFor: ['req', 'request', '$scope'] }], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's include acc
for reduce
accumulators, and res
and response
for express responses, and e
for e.returnValue =
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also let's split the options object (and the array) onto multiple lines, so that each exclusion can get a comment describing why it's in the array.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I resolved this in 5d3c171 by adding those 4 exceptions and adding comments for each.
@@ -164,9 +164,9 @@ module.exports = { | |||
'no-octal-escape': 'error', | |||
|
|||
// disallow reassignment of function parameters | |||
// disallow parameter object manipulation | |||
// disallow parameter object manipulation except req, request, and $scope |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think this should rename generic, ie, "except for specific exclusions"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, thanks! Resolved in 940d598.
43f1a92
to
5d3c171
Compare
@ljharb Are there any other steps I should take to get this merge-ready? |
@christianbundy Awesome! Can we add |
Done! Let me know if you'd like to squash my commits before the merge, thanks for working with me on this PR. |
@christianbundy yes, please do rebase it down to one commit :-) please also prefix the commit message with |
fb103e0
to
3475264
Compare
Weird, this page started throwing HTTP 500 errors after I force-pushed, and it looks like it auto-closed? Anyway, I re-opened it with the new commit message, please let me know if there's anything else. |
After this changes, I'm getting this error:
I have these versions in my package.json:
If I change back to the oldest version, everything works properly. Do you have any suggestions about it? |
Hey @coldfish, do you get any errors when you run |
After
Based on the installation documentation (https://github.com/airbnb/javascript/tree/master/packages/eslint-config-airbnb), I have installed these versions after getting the output of "
So I thought they're the right dependencies to proceed. Should we have update the documentation for this problem? Thanks for your quick reply. |
It looks like you're right, that The peerDependency you mentioned above is
|
Thanks @christianbundy. This answer is pretty enough for me. As you said, most probably, I've made a mistake while installing the packages related to caret. After updating the version to 3.18.0, the error has gone. |
Also note, when updating |
This adds exceptions to
no-param-reassign
to resolve #1217. There's probably some discussion to be done around which variables should be ignored, but currently I've addedreq
,request
, and$scope
from this comment.Please let me know if you have any questions, or if there are any changes you'd like for me to make. Thanks!
Closes #1217